<?php
/* -----------------------------------------------------------------------------------------
   $Id: fuzzy_search.php

   XT-Commerce - community made shopping
   http://www.xt-commerce.com

   Copyright (c) 2003 XT-Commerce

   Released under the GNU General Public License
   ---------------------------------------------------------------------------------------
   
   3rd-party contribution: 'fuzzy search' by Thorsten Reineke (c) 2006 www.get-attention.de
   
   ---------------------------------------------------------------------------------------*/

  // wenn keywords aus Suche übergeben -> fuzzy search
if (($_GET['keywords']) && (SEARCH_ACTIVATE_SUGGEST == 'true')){

  require_once (DIR_FS_INC.'xtc_get_products_image.inc.php');
  require_once (DIR_WS_CLASSES.'fuzzy_search.php');

	$keywords = strtolower($_GET['keywords']);

	$Suggest = new FuzzySearch();
	$Suggest->getSuggest($keywords);
	$module_content_keywords = $Suggest->resultKeywords;
	$module_content_products = $Suggest->new_fuzzy;
	$parse_time = $Suggest->parse_time;

	if($module_content_keywords)
		$module_smarty->assign('keyword_data', $module_content_keywords);

	if ($module_content_products){
		$info_smarty = new Smarty;
		$info_smarty->assign('tpl_path','templates/'.CURRENT_TEMPLATE.'/');
		$info_smarty->assign('language', $_SESSION['language']);
		$info_smarty->assign('module_content', $module_content_products);
                $info_smarty->assign('CLASS', 'product_listing');//JS SCRIPT ERROR WENN NICHT VORHANDEN
		$info_smarty->caching = 0;
		$module_smarty->assign('suggest_products', $info_smarty->fetch(CURRENT_TEMPLATE.'/module/product_listings.html'));
	} 

	if (SEARCH_SHOW_PARSETIME == 'true')
		$module_smarty->assign('PARSE_TIME', '<small>'.$parse_time.' s</small>');    
}
?>
